package headfirst.combined.djview;
import java.awt.*;
import java.io.IOException;

import javax.sound.sampled.*;


public class Motor {//implements Runnable{
	private static Motor instance;
	int rpm;
	
	public static Motor getInstance(){
		if (instance == null) {
			instance = new Motor();
		}
		return instance;
	}
	
	private Motor(){
		rpm=0;
	}
	/*
	public void run() {
		for(;;) {
				try {
					//sonido();
					
					Thread.sleep(50);
				} catch (Exception e) {};
		
		}
	}
	
	public void sonido()throws LineUnavailableException, IOException, UnsupportedAudioFileException{
		try {
			Clip sonido=AudioSystem.getClip();
			sonido.open(AudioSystem.getAudioInputStream(getClass().getResourceAsStream("/censor-beep-2.wav")));
	        sonido.start();
		}catch (LineUnavailableException | IOException | UnsupportedAudioFileException e){
			e.printStackTrace();
		}
	}
	*/
	
	public int get_rpm(){
		return rpm;
	}
	
	public void set_rpm(int _rpm){
		rpm=_rpm;
	}
}
